package thing

import (
	"github.com/gin-gonic/gin"
	logic2 "iot-base/auth/api/logic"
	Log "iot-base/auth/logger"
	types2 "iot-base/auth/types"
)

func Video(c *gin.Context) {
	requestId, _ := c.Get("RequestId")
	uid := c.GetInt64("uid")
	resp := types2.NewResult(c)
	var req types2.ReqGetThingByStationId
	if err := c.ShouldBind(&req); err != nil {
		Log.Log.Errorf("[%s] [%v] err:=%v", requestId, uid, err)
		resp.ErrorCode(types2.ParamsError, "")
		return
	}
	cameraLogic := logic2.NewCameraLogic()
	result, err := cameraLogic.GetThingByStation(uid, req.GroupId, req.StationId)
	if err != nil {
		Log.Log.Errorf("[%s] [%v] err:=%v", requestId, uid, err)
		resp.ErrorCode(types2.DBError, "")
		return
	}
	resp.Success(result)
}
